﻿
@{
    ViewBag.Title = "CancelPartialConfirmForm";
    Layout = "~/Views/Shared/_Form.cshtml";

    //默认支付方式
    var defaultPayMethod = SysConfigReader.String("Sett_PayMethod_Inp_Default");
    //住院结算可以用预交金
    var withYjj = SysConfigReader.Bool("InpatientSettWithAdvanceAccount");
}
<div id="divCQYbFee" class="panel panel-default" style="margin-top:10px;margin-left:10px;margin-right: 10px;">
    <div style="height:auto;">
        <table class="form">
            <tr>
                <th class="formTitle">退还支付差额：</th>
                <td class="formValue">￥<label id="th_zfce" style="color:red">0.00</label></td>
                </tr>
            <tr>
                <th class="formTitle">支付方式：</th>
                <td class="formValue">
                    <select id="zffs1" class="form-control  form-an" style="width:90%">
                        <option value="">==请选择==</option>
                    </select>
                </td>
            </tr>
        </table>
    </div>
</div>
<script type="text/javascript">
    var defaultPayMethod = "@(defaultPayMethod)";
    var jsnm = $.request("jsnm");
    var prevWindow = $.currentWindow();
    var withYjj = '@(withYjj)';
    var yjjye = 0;
    $(function () {
        init();
        //现金支付方式1
        $("#zffs1").newtouchBindSelect({
            datasource: function () {
                //var resultObjArr = new Array();
                $.each(top.clients.SysForCashPayList, function (key, value) {
                    var sele = false;

                    //if (!yjjye && value.xjzffs == '3') {
                    //    return; //当前账户无预交金余额，则不显示该支付方式
                    //}
                    if (value.xjzffs == defaultPayMethod) {
                        sele = true;
                    }
                    if (sele) {
                        $('#zffs1').append('<option value="' + value.xjzffs + '" selected=true>' + value.xjzffsmc + '</option>');
                    }
                    else {
                        $('#zffs1').append('<option value="' + value.xjzffs + '">' + value.xjzffsmc + '</option>');
                    }
                });
                //return resultObjArr;
            }
        });
    })

    function init() {
        $.najax({
            type: "POST",
            data: { jsnm: jsnm },
            url: "@Url.Action("Getrefunds_available")",
            dataType: "json",
            async: false,
            loading: false,
            success: function (resp) {
                if (resp.state == 'success') {
                    $('#th_zfce').html(resp.data);
                }
            }
        });

        if (withYjj == 'True') {
            $.najax({
                url: "/PatientManage/AccountManage/GetZhyeByPatid?patid=" + $.request("patid"),
                cache: false,
                async: false,
                alertbierror: false,
                success: function (zhyeData) {
                    if (zhyeData && zhyeData.data) {
                        yjjye = zhyeData.data;
                    }
                }
            });
        }
    }

    function submitform() {
        if ($('#zffs1').val()=="") {
            $.modalAlert("缺少现金支付方式", "warning");
            return;
        }
        
        prevWindow.CancelTheLastMidwaySett($('#zffs1').val(), $("#zffs1 option:checked").text(),jsnm);
        $.modalClose();
    }
</script>

